<div class="container-fluid" style="margin-top: 10px;">
    <div class="row">
        <form id="inputForm" action="add">
            {:buildForm($config,$data)}
        </form>
        <div class="col-sm-12" style="margin-top: 10px;text-align: center">
            <button id="addButton" class="btn btn-info">新增</button>
        </div>
    </div>
</div>

<script>

    $(function () {
        $("#addButton").on('click',function () {
            layer.confirm('确认新增车辆吗？',function (index) {
                layer.close(index);
                layer.load();
                $("#inputForm").ajaxSubmit(function (text) {
                    console.log(text);
                    layer.closeAll('loading');
                    var json = JSON.parse(text);
                    if(json['code'] == '200'){
                        layer.alert(json['msg'],{icon:1},function (index) {
                            layer.close(index);
                            parent.location.reload();
                        })
                    }
                    else{
                        layer.alert(json['msg'],{icon:2});
                    }
                });
            });
        });
    });

</script>